@model OrchardCore.Autoroute.ViewModels.AutoroutePartSettingsViewModel

<script asp-name="codemirror" depends-on="admin" at="Foot"></script>
<script asp-name="codemirror-mode-javascript" at="Foot"></script>
<script asp-name="codemirror-addon-display-autorefresh" at="Foot"></script>
<script asp-name="codemirror-addon-mode-simple" at="Foot"></script>
<script asp-name="codemirror-addon-mode-multiplex" at="Foot"></script>
<script asp-name="codemirror-mode-xml" at="Foot"></script>

<script asp-src="~/OrchardCore.Liquid/codemirror/liquid.js" at="Foot"></script>

<div class="form-group row">
    <div class="col-lg">
        <label asp-for="Pattern">@T["Pattern"]</label>
        <textarea asp-for="Pattern" rows="5" class="form-control"></textarea>
        <span class="hint">@T["The pattern used to render the custom url of this content type."]</span>
    </div>
</div>

<div class="form-group">
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" asp-for="AllowCustomPath" checked="@Model.AllowCustomPath">
        <label class="custom-control-label" asp-for="AllowCustomPath">@T["Allow custom path"]</label>
        <span class="hint">@T["Check to allow users to set a custom path, otherwise it will be automatically generated."]</span>
    </div>
</div>

<div class="form-group">
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" asp-for="AllowUpdatePath" checked="@Model.AllowUpdatePath">
        <label class="custom-control-label" asp-for="AllowUpdatePath">@T["Allow path updates"]</label>
        <span class="hint">@T["Check to allow users to refresh the path once a content item is already published."]</span>
    </div>
</div>

<div class="form-group">
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" asp-for="ShowHomepageOption" checked="@Model.ShowHomepageOption">
        <label class="custom-control-label" asp-for="ShowHomepageOption">@T["Show homepage options"]</label>
        <span class="hint">@T["Check to allow the content items of this content type to be set as the homepage. It will only be visible to users with the appropriate permission."]</span>
    </div>
</div>

<script at="Foot" depends-on="jquery">
    //<![CDATA[
    $(function () {
        editor = CodeMirror.fromTextArea(document.getElementById('@Html.IdFor(x => x.Pattern)'), {
            autoRefresh: true,
            lineNumbers: true,
            styleActiveLine: true,
            matchBrackets: true,
            mode: { name: "liquid" },
        });
    });
    //]]>
</script>